.article_content
  %h2
    = "##{@article.id} #{@article.title}"
    - if admin?
      %span= link_to "Edit", :action => :edit, :id => @article.id
      - if controller.action_name == "sortable"
        %span{:style => "margin-right:10px;"}= link_to "Show", :action => :show, :id => @article.id    
      - if controller.action_name == "show"
        %span{:style => "margin-right:10px;"}= link_to "Sort", :action => :sortable, :id => @article.id
  .article_tag_list= show_tag_list(@article)
  .article_summary= @article.summary
  #warp_for_sortable
    = render :partial => "articles/article", :object => @article, :locals => { :edit_mode => false }
- if controller.action_name == "sortable"
  :javascript
    $(function() {
    	$("#warp_for_sortable").sortable({
    		placeholder: 'ui-state-highlight',
    		update: function(event, ui) {	
          serial = $('#warp_for_sortable').sortable("serialize");
          $.ajax({
            url: "#{url_for(:action => "update_sortable", :id => @article.id)}", 
            type: "post", 
            data: serial,
            error: function(){ alert("theres an error with AJAX"); },
            dataType: "script"
          });
    		}
    	});
    	$("#warp_for_sortable").disableSelection();
    });